<template>
  <div>
      <ul>
          <li v-for="(item,index) in arr " :key="item">
              <span>{{item}}--{{index}}</span>
              <button @click="del">删除</button>
          </li>
      </ul>
      <button @click="sc">生成</button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            arr:[1]
        }
    },
        methods: {
            del(){  
                // console.log(1)
               this.arr.splice(1, 1);
            },
            sc(){
                // console.log(2)
                this.arr.push(parseInt(Math.random()*10))
            }
        },
}
</script>

<style>

</style>